package homework.test2;


import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
/*
会使用带会返回值方式创建线程并获取返回值
 */
public class Demo2 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        MyCallable mc = new MyCallable();

        FutureTask<String> ft = new FutureTask<>(mc);
        Thread t = new Thread(ft);
        t.start();
        String s = ft.get();
        System.out.println(s);
    }
}
